package com.sunseaypw.springmvc.intercepts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sunseaypw.springmvc.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

@Order(2)
@Component
public class AuthInterceptor implements HandlerInterceptor {
    @Autowired
    UserService userService;

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
            throws Exception {
        System.out.println("preHandlepreHandlepreHandlepreHandlepreHandle1111111111111");
        return true;
    }
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,ModelAndView mv)
            throws Exception {
        System.out.println("postHandlepostHandlepostHandlepostHandlepostHandle222222222222"+handler.toString());
        
    }
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,Exception ex)
            throws Exception {
        System.out.println("afterCompletionafterCompletionafterCompletionafterCompletion333333333333333333");
        
    }
    
}